﻿
using Microsoft.AspNetCore.Mvc;
using VegetableSale.NET.Entities;
using VegetableSale.NET.Services;

namespace VegetableSale.NET.Controllers;

[ApiController]
[Route("api/[Action]")]
public class RtsaleController : Controller
{
    private SaleService saleService = new SaleService();

    [HttpPost(Name = "/salelist")]
    public Result salelist([FromBody] QueryDTO queryDTO)
    {
        return saleService.getSaleList(queryDTO);
    }

    [HttpPost(Name = "saleAllGood")]
    public Result saleAllGood()
    {
        return saleService.saleAllGood();
    }
    
    [HttpPost(Name = "saledeletesale")]
    public Result saledeletesale(int id)
    {
        return saleService.deleteSale(id);
    }

    [HttpPost(Name = "saleaddsale")]
    public Result saleaddsale(SaleQuery saleQuery)
    {
        return saleService.addSale(saleQuery);
    }

    [HttpPost(Name = "saleupdatesale")]
    public Result saleupdatesale(SaleUpdateQuery saleUpdateQuery)
    {
        return saleService.updateSale(saleUpdateQuery);
    }
}

